package org.zfes.snowier.zbss.xzy.biz.vedio.controller;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.zbss.xzy.biz.vedio.model.CloudVedio;
import org.zfes.snowier.zbss.xzy.biz.vedio.service.ICloudVedioService;
import org.zfes.snowier.core.data.SelectVo;
@Controller 
@RequestMapping("/agreement")
public class CloudVedioController implements BaseController {

	
	@Autowired
	private ICloudVedioService cloudVedioService;
	
	//@RequiresPermissions(value="cloudVedio:loadCloudVedioDataSet",desc="视频点播列表")
    @RequestMapping(value="/loadCloudVedioDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadCloudVedioDataSet(@RequestBody Map<String,Object> params){
	    DataSet dataSet=  cloudVedioService.loadCloudVedioDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	//@RequiresPermissions(value="cloudVedio:createCloudVedio",desc="视频点播添加")
    @RequestMapping(value="/createCloudVedio", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public  @ResponseBody Object createCloudVedio(@RequestBody CloudVedio cloudVedio){
		cloudVedioService.createCloudVedio(cloudVedio);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="cloudVedio:loadCloudVedio",desc="视频点播加载")
    @RequestMapping(value="/loadCloudVedio/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadCloudVedio(@PathVariable("id")Long id){
		Optional<CloudVedio> ops = cloudVedioService.loadCloudVedioById(id);
		return ajaxQuery("cloudVedio",ops);
    }
	
	//@RequiresPermissions(value="cloudVedio:updateCloudVedio",desc="视频点播更新")
    @RequestMapping(value="/updateCloudVedio", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object updateCloudVedio(@RequestBody  CloudVedio cloudVedio){
		cloudVedioService.updateCloudVedio(cloudVedio);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="cloudVedio:deletCloudVedio",desc="视频点播删除")
    @RequestMapping(value="/deleteCloudVedio/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object deleteCloudVedio(@PathVariable("id")Long id){
		cloudVedioService.deleteCloudVedio(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }


    @RequestMapping(value="/loadCloudVedioSelectVo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadCloudVedioSelectVo(){
		 List<SelectVo>  ops = cloudVedioService.loadCloudVedioSelectVo("");
		return ajaxQuery("selectVo",ops);
    }
    
}